<template>
	<view>
		<u-tabbar class="tabbar-ios-fix" activeColor='#52A0F3' :value="current" :fixed="true"
			:placeholder="true" :safeAreaInsetBottom="true" @change="handleTabClick">
			<u-tabbar-item v-for='(item,index) in tabList' :key="index" :text="item.text" :icon="item.iconPath" :name="item.name">
				
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>
 
<script>

	export default {
		props: {
			current: String
		},
		data() {
			return {
				tabList: [
                    {
                        "text": "首页",
                        "name":"home",
                        "pagePath": "pages/index/index",
                        "iconPath": "home-fill"
                    },
                    {
                        "text": "售后整改",
                        "name":"sales",
                        "pagePath": "pages/sales/index",
                        "iconPath": "file-text"
                    },
                    {
                        "text": "售后维修",
                        "name":"keep",
                        "pagePath": "pages/sales/keep",
                        "iconPath": "file-text"
                    },
                    {
                        "text": "日报",
                        "name":"daily",
                        "pagePath": "pages/produce/daily",
                        "iconPath": "calendar"
                    }, {
                        "text": "设置",
                        "name":"basic",
                        "pagePath": "pages/kehu/basic",
                        "iconPath": "setting-fill"
                    }
                ]
			};
		},
		mounted() {
			console.log(this.tabList)
		},
		methods: {
			handleTabClick(index) {
                var url
                switch(index){
                    case "home":
                        url = "/pages/index/index";
                        break;
                    case "sales":
                        url = "/pages/sales/index";
                        break;
                    case "basic":
                        url = "/pages/kehu/basic";
                        break;
                    case "daily":
                         url = "/pages/produce/daily";
                        break;
                    case "keep":
                        url = "/pages/sales/keep";
                        break;
                }
				// 使用 uni.switchTab 方法切换页面
				uni.navigateTo({
					url: url,
				});
 
			},
		}
	}
</script>
 
<style lang="scss">
	.u-page__item__slot-icon {
		width: 50rpx;
		height: 50rpx;
	}
 
	.tabbar-ios-fix {
		bottom: calc(120rpx + env(safe-area-inset-bottom));
	}
</style>